package com.zsrt.java.day20170111.lh.daily.ch06;

import static org.junit.Assert.*;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.junit.Test;

public class PatternTest {
	
	public static void main(String[] args) {
		
		
//		Pattern p=new Pattern();
		
		//
		
		//正则表达式 ：专门用来查找一个字符串 是不是有指定的字符串
		
		String xx=" 两个武功，九阳神功, 大挪移";
		
		
		//定义规则
		String guize="九阳神功";
		
		//编译
		Pattern reg = Pattern.compile(guize);
		
		
		//去查找
		Matcher matcher = reg.matcher(xx);
		
		boolean jieguo = matcher.matches();
		
			
		
		//结果
		System.out.println(jieguo);
		
		
	}
	
	@Test
	public void testName() throws Exception {
		
		
		 Pattern p = Pattern.compile("a*b+.");
		 Matcher m = p.matcher("aaaaabb");
		 boolean b = m.matches();
		 System.out.println(b);
	}

}
